Neighbourhood Components Analysis
Paper: https://www.cs.toronto.edu/~hinton/absps/nca.pdf
A blog post that explains the method: https://kevinzakka.github.io/2020/02/10/nca/ and code: https://github.com/kevinzakka/torchnca
This method finds a linear transformation of the data that maximizes the performance of the k nearest neighbors algorithm.